<template>
	<view class="container">
		<view v-if="currentTab == 0">
			<view class="header-box">
				<view style="display: flex; height: 84rpx; line-height: 84rpx; vertical-align: bottom">
					<view>欢迎来到</view>
					<view style="font-size: 60rpx">栖木社</view>
				</view>
				<view class="header-title">完善注册，好友相识不迷路</view>
			</view>
			<view class="avatar-add" v-if="winInfo.uniPlatform != 'mp-weixin'" @tap="appChooseAvatar">
				<image :src="FormData.Avatar || '/static/images/my/noAvatar.svg'" class="avatar"></image>
				<image src="/static/images/common/camera.png" class="camear-img"></image>
			</view>
			<button open-type="chooseAvatar" v-else @chooseavatar="onChooseAvatar" class="avatar-add">
				<image :src="FormData.Avatar || '/static/images/my/noAvatar.svg'" class="avatar"></image>
				<image src="/static/images/common/camera.png" class="camear-img"></image>
			</button>
			<view class="input-cell">
				<view class="input-title">姓名</view>
				<view class="input-box">
					<input type="text" style="width: 100%" v-model="FormData.Name" placeholder="请填写真实姓名" />
				</view>
			</view>
			<view class="input-cell">
				<view class="input-title">性别</view>
				<view class="input-box" style="background: none; border: 0; padding: 18rpx 0; justify-content: flex-start">
					<view
						class="sex-box"
						v-for="(item, index) in sexArray"
						:key="index"
						@tap="changeSex(index)"
						:style="{ background: FormData.SexIndex == index ? item.bgc : '#f3f5f9', color: FormData.SexIndex == index ? item.color : '#999999' }"
					>
						<!-- <image :src="item.img" class="sex-img"></image> -->
						<image :src="FormData.SexIndex == index ? item.img : item.img1" class="sex-img" alt="icon" />
						<view>{{ item.value }}</view>
					</view>
				</view>
			</view>
			<view class="input-cell">
				<view class="input-title">出生年月</view>
				<view class="input-box" style="background: none; border: 0; padding: 18rpx 0; justify-content: flex-start">
					<picker mode="date" :value="FormData.ChushengNY" @change="bindDateChange">
						<view class="picker-view">
							<view>{{ FormData.ChushengNY || '请选择' }}</view>
							<tui-icon name="arrowdown" color="#999" size="20"></tui-icon>
						</view>
					</picker>
				</view>
			</view>
		</view>
		<view v-else-if="currentTab == 1">
			<view class="header-box">
				<view style="display: flex; height: 84rpx; line-height: 84rpx; vertical-align: bottom">
					<view>完善个人信息</view>
				</view>
				<view class="header-title">为您推荐行业热点,发现更多优质人脉机遇</view>
			</view>
			<view class="input-cell" style="margin-top: 90rpx">
				<view class="input-title">当前身份状态</view>
				<view class="input-box" style="background: none; border: 0; padding: 18rpx 0; height: auto">
					<image class="sf-box" :src="FormData.sfIndex == index ? item.img1 : item.img" v-for="(item, index) in sfArray" @tap="FormData.sfIndex = index" />
				</view>
			</view>
			<view v-if="FormData.sfIndex == 0">
				<view class="input-cell" @tap="chooseGongsi">
					<view class="input-title">当前就职公司</view>
					<view class="input-box" style="border: 0; justify-content: space-between">
						<!-- <zxz-uni-data-select
							v-model="userInfo.Gongsi"
							placeholder="公司/单位名称"
							:localdata="companyArray"
							:key="Id"
							filterable
							dataValue="GongsiM"
							dataKey="GongsiM"
							style="width: 100%"
							@change="companyChange"
						></zxz-uni-data-select> -->
						<view class="input-info" :style="{ color: FormData.Gongsi ? '#000' : '#999' }">
							{{ FormData.Gongsi || '请选择' }}
						</view>
						<image src="/static/images/common/down.svg" class="down-img"></image>
					</view>
				</view>
				<view class="input-cell" @tap="hangyeChoose">
					<view class="input-title">行业</view>
					<view class="input-box">
						<m-cascader
							v-model="FormData.Gangwei"
							:options="GangweiArray"
							:fieldProps="{
								value: 'Id',
								label: 'GangweiM',
								children: '_Child'
							}"
							:multiple="false"
							:save-full-path="true"
							:disabled="true"
							placeholder="请选择岗位"
							style="width: 100%"
						/>
						<image src="/static/images/common/down.svg" class="down-img"></image>
						<!-- <uni-data-select style="width: 100%" v-model="FormData.Gongsi" :localdata="Array.companyArray" placeholder="公司/单位名称"></uni-data-select> -->
					</view>
				</view>
				<view class="input-cell" @tap="chooseZhiwei">
					<view class="input-title">职位</view>
					<view class="input-box" style="justify-content: space-between">
						<view class="input-info">
							<view :style="{ color: FormData.Zhiwei ? '#000' : '#999' }">{{ FormData.Zhiwei || '职位/职务名称' }}</view>
						</view>
						<image src="/static/images/common/down.svg" class="down-img"></image>
						<!-- <zxz-uni-data-select
							v-model="FormData.Zhiwei"
							placeholder="职位/职务名称"
							:localdata="zhiweiArray"
							:key="Id"
							filterable
							dataValue="Value"
							dataKey="Value"
							style="width: 100%"
						></zxz-uni-data-select>
						<image src="/static/images/common/down.svg" class="down-img"></image> -->
						<!-- <uni-data-select style="width: 100%" v-model="FormData.Gongsi" :localdata="Array.companyArray" placeholder="公司/单位名称"></uni-data-select> -->
					</view>
				</view>
				<view class="input-cell">
					<view class="input-title">薪资/月</view>
					<view class="input-box" style="width: 304rpx">
						<picker mode="selector" style="width: 100%" range-key="Value" :range="XinziArray" @change="changePicker($event, 'Xinzi', 'XinziArray')">
							<view class="input-info" style="display: flex; align-items: center; justify-content: space-between">
								<view :style="{ color: FormData.Xinzi ? '#000' : '#999' }">{{ FormData.Xinzi || '薪资范围' }}</view>
								<image src="/static/images/common/down.svg" mode="widthFix" class="down-img"></image>
							</view>
						</picker>
						<!-- <zxz-uni-data-select
							v-model="FormData.Xinzi"
							placeholder="薪资范围"
							:localdata="XinziArray"
							:key="Id"
							filterable
							dataValue="Value"
							dataKey="Value"
							style="width: 100%"
						></zxz-uni-data-select>
						<image src="/static/images/common/down.svg" class="down-img"></image> -->
						<!-- <uni-data-select style="width: 100%" v-model="FormData.Gongsi" :localdata="Array.companyArray" placeholder="公司/单位名称"></uni-data-select> -->
					</view>
				</view>
			</view>
			<view v-else-if="FormData.sfIndex == 1">
				<view class="input-cell" @tap="chooseSchool">
					<view class="input-title">学校</view>
					<view class="input-box" style="justify-content: space-between">
						<!-- <zxz-uni-data-select
							v-model="FormData.BiyeYX"
							placeholder="请选择学校"
							:localdata="schoolArray"
							:key="Id"
							filterable
							dataValue="GongsiM"
							dataKey="GongsiM"
							style="width: 100%"
						></zxz-uni-data-select> -->
						<view class="input-info" :style="{ color: FormData.BiyeYX ? '#000' : '#999' }">
							{{ FormData.BiyeYX || '请选择' }}
						</view>
						<image src="/static/images/common/down.svg" class="down-img"></image>
						<!-- <uni-data-select style="width: 100%" v-model="FormData.Gongsi" :localdata="Array.companyArray" placeholder="公司/单位名称"></uni-data-select> -->
					</view>
				</view>
				<view class="input-cell">
					<view class="input-title">学历</view>
					<view class="input-box">
						<picker mode="selector" style="width: 100%" range-key="Value" :range="xueliArray" @change="changePicker($event, 'ZuigaoXL', 'xueliArray')">
							<view class="input-info" style="justify-content: space-between">
								<view :style="{ color: FormData.ZuigaoXL ? '#000' : '#999' }">{{ FormData.ZuigaoXL || '最高学历' }}</view>
								<image src="/static/images/common/down.svg" class="down-img"></image>
							</view>
						</picker>
						<!-- <zxz-uni-data-select
							v-model="FormData.ZuigaoXL"
							placeholder="请选择学历"
							:localdata="xueliArray"
							:key="Id"
							filterable
							dataValue="Value"
							dataKey="Value"
							style="width: 100%"
							@change="schoolChange"
						></zxz-uni-data-select>
						<image src="/static/images/common/down.svg" class="down-img"></image> -->
						<!-- <uni-data-select style="width: 100%" v-model="FormData.Gongsi" :localdata="Array.companyArray" placeholder="公司/单位名称"></uni-data-select> -->
					</view>
				</view>
				<view class="input-cell" @tap="chooseZhuanye">
					<view class="input-title">专业</view>
					<view class="input-box" style="justify-content: space-between">
						<view class="input-info" :style="{ color: FormData.Zhuanye ? '#000' : '#999' }">
							{{ FormData.Zhuanye || '请选择' }}
						</view>
						<image src="/static/images/common/down.svg" class="down-img"></image>
					</view>
				</view>
				<view class="input-cell">
					<view class="input-title">入学时间</view>
					<view class="input-box" style="width: 304rpx; justify-content: normal">
						<!-- <view @tap="Ruxuevisible = true">{{ FormData.RuxueStart || '请选择' }}-{{ FormData.RuxueEnd || '请选择' }}</view> -->
						<picker @change="bindPickerChange($event, 'RuxuestartIndex')" :value="FormData.RuxuestartIndex" :range="startYearArray">
							<view class="input-info">{{ startYearArray[FormData.RuxuestartIndex] }}</view>
						</picker>
						<tui-icon name="reduce" color="#000" bold="true" size="20"></tui-icon>
						<picker @change="bindPickerChange($event, 'RUxueendIndex')" :value="FormData.RUxueendIndex" :range="endYearArray">
							<view class="input-info">{{ endYearArray[FormData.RUxueendIndex] }}</view>
						</picker>
						<image src="/static/images/common/down.svg" class="down-img"></image>
						<!-- <uni-data-select style="width: 100%" v-model="FormData.Gongsi" :localdata="Array.companyArray" placeholder="公司/单位名称"></uni-data-select> -->
					</view>
				</view>
			</view>
			<view v-else>
				<view class="input-cell" @tap="hangyeChoose">
					<view class="input-title">行业</view>
					<view class="input-box">
						<m-cascader
							v-model="FormData.Gangwei"
							:options="GangweiArray"
							:fieldProps="{
								value: 'Id',
								label: 'GangweiM',
								children: '_Child'
							}"
							:multiple="false"
							:save-full-path="true"
							:disabled="true"
							placeholder="请选择岗位"
							style="width: 100%"
						/>
						<image src="/static/images/common/down.svg" class="down-img"></image>
						<!-- <uni-data-select style="width: 100%" v-model="FormData.Gongsi" :localdata="Array.companyArray" placeholder="公司/单位名称"></uni-data-select> -->
					</view>
				</view>
				<view class="input-cell">
					<view class="input-title">薪资/月</view>
					<view class="input-box" style="width: 304rpx">
						<picker mode="selector" style="width: 100%" range-key="Value" :range="XinziArray" @change="changePicker($event, 'Xinzi', 'XinziArray')">
							<view class="input-info" style="display: flex; align-items: center; justify-content: space-between">
								<view :style="{ color: FormData.Xinzi ? '#000' : '#999' }">{{ FormData.Xinzi || '薪资范围' }}</view>
								<image src="/static/images/common/down.svg" class="down-img"></image>
							</view>
						</picker>
						<!-- <zxz-uni-data-select
							v-model="FormData.Xinzi"
							placeholder="薪资范围"
							:localdata="XinziArray"
							:key="Id"
							filterable
							dataValue="Value"
							dataKey="Value"
							style="width: 100%"
						></zxz-uni-data-select>
						<image src="/static/images/common/down.svg" class="down-img"></image> -->
						<!-- <uni-data-select style="width: 100%" v-model="FormData.Gongsi" :localdata="Array.companyArray" placeholder="公司/单位名称"></uni-data-select> -->
					</view>
				</view>
			</view>
			<view class="input-cell">
				<view class="input-title">所在地点</view>
				<view class="input-box">
					<m-cascader
						v-model="FormData.Diqu"
						:options="AddressDate"
						:fieldProps="{
							value: 'text',
							label: 'text'
						}"
						:multiple="false"
						:save-full-path="true"
						:disabled="false"
						placeholder="目前所在地区"
						style="width: 100%; font-family: PingFang SC, PingFang SC; font-size: 26rpx; text-align: center; font-style: normal; text-transform: none"
					/>
					<image src="/static/images/common/down.svg" class="down-img"></image>
				</view>
			</view>
		</view>

		<view class="btn-box" @tap="submit">
			{{ btnName }}
		</view>
	</view>
</template>

<script>
import MCascader from '@/components/m-cascader/m-cascader.vue';
export default {
	data() {
		return {
			Islogin: this.Microi.IsLogin(),
			CurrentUser: this.Microi.GetCurrentUser(),
			winInfo: {},
			FormData: {
				Avatar: '',
				Name: '',
				Sex: '男',
				ChushengNY: '',
				SexIndex: 0,
				sfIndex: 0,
				Gangwei: '',
				Gongsi: '',
				GongsiID: '',
				Zhiwei: '',
				Xinzi: '',
				Zhuanye: '',
				BiyeYX: '',
				ZuigaoXL: '',
				RuxuestartIndex: 0,
				RUxueendIndex: 0,
				XuexiaoID: '',
				Diqu: ''
			},
			AddressDate: [],
			currentTab: 0,
			IsDisabled: false,
			btnName: '下一步',
			startYearArray: [],
			endYearArray: [],
			xueliArray: [],
			XinziArray: [],
			schoolArray: [],
			companyArray: [],
			GangweiArray: [],
			hangyeArray: [],
			zhiweiArray: [],
			MajorArray: [],
			sfArray: [
				{
					img: '/static/images/common/zaizhi.png',
					img1: '/static/images/common/zaizhi-fill.png'
				},
				{
					img: '/static/images/common/student.png',
					img1: '/static/images/common/student-fill.png'
				},
				{
					img: '/static/images/common/nowork.png',
					img1: '/static/images/common/nowork-fill.png'
				}
			],
			sexArray: [
				{
					value: '男',
					img: '/static/images/common/boy.png',
					img1: '/static/images/common/boy1.png',
					bgc: '#E1EDF9',
					color: '#FB353B'
				},
				{
					value: '女',
					img: '/static/images/common/girl.png',
					img1: '/static/images/common/girl1.png',
					bgc: '#F9E1E1',
					color: '#FA1B0A'
				}
			],
			Ruxuevisible: false
		};
	},
	mounted() {
		let obj = {};
		// #ifdef MP-WEIXIN
		obj = wx.getMenuButtonBoundingClientRect();
		// #endif
		// #ifdef MP-BAIDU
		obj = swan.getMenuButtonBoundingClientRect();
		// #endif
		// #ifdef MP-ALIPAY
		my.hideAddToDesktopMenu();
		// #endif

		setTimeout(() => {
			uni.getSystemInfo({
				success: (res) => {
					this.winInfo = res;
					this.winInfo.width = obj.left || res.windowWidth;
					this.winInfo.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44;
					this.winInfo.top = obj.top ? obj.top + (obj.height - 32) / 2 : res.statusBarHeight + 6;
					this.winInfo.scrollH = res.windowWidth;
				}
			});
		}, 0);
	},
	onShow() {
		if (uni.getStorageSync('schoolInfo')) {
			this.FormData.BiyeYX = uni.getStorageSync('schoolInfo').name;
			this.FormData.XuexiaoID = uni.getStorageSync('schoolInfo').Id;
			uni.removeStorageSync('schoolInfo');
		}
		if (uni.getStorageSync('companyInfo')) {
			this.FormData.Gongsi = uni.getStorageSync('companyInfo').name;
			this.FormData.GongsiID = uni.getStorageSync('companyInfo').Id;
			uni.removeStorageSync('companyInfo');
		}
		if (uni.getStorageSync('Zhiwei')) {
			this.FormData.Zhiwei = uni.getStorageSync('Zhiwei').name;
			// this.userInfo.GongsiID = uni.getStorageSync('companyInfo').Id;
			uni.removeStorageSync('Zhiwei');
		}
		if (uni.getStorageSync('GangweiM')) {
			this.FormData.Gangwei = uni.getStorageSync('GangweiM').Id;
			// this.userInfo.GongsiID = uni.getStorageSync('companyInfo').Id;
			uni.removeStorageSync('GangweiM');
		}
		if (uni.getStorageSync('Zhuanye')) {
			this.FormData.Zhuanye = uni.getStorageSync('Zhuanye').name;
			uni.removeStorageSync('Zhuanye');
		}
	},
	onLoad(options) {
		if (options.currentTab) this.currentTab = options.currentTab;
		this.getFabuInfo();
		this.getCityData();
	},
	methods: {
		async getCityData() {
			var res = await this.Microi.ApiEngine.Run('get_cityData');
			this.AddressDate = res.Data;
		},
		changePicker(e, name1, name2, value = 'Value') {
			this.FormData[name1] = this[name2][e.detail.value][value];
		},
		getFabuInfo() {
			var yearInfo = [];
			var yearNow = parseInt(new Date().getFullYear());
			this.endYearArray = ['至今'];
			for (var year = yearNow; year >= 1990; year--) {
				this.endYearArray.push(year);
				this.startYearArray.push(year);
			}
			this.FormData.RuxuestartIndex = 3;
			// this.getCompanyInfo();
			this.getGangweiInfo();
			// this.getZhiweiInfo();
			this.getXinziInfo();
			// this.getSchoolInfo();
			this.getMajorInfo();
			this.getxueliInfo();
		},
		hangyeChoose() {
			uni.navigateTo({
				url: '/pages/my/companyChoose/zhiweiChoose'
			});
		},
		// 专业选择
		chooseZhuanye() {
			uni.navigateTo({
				url: '/pages/my/companyChoose/commonChoose?Type=10&headerTitle=专业&InfoName=Zhuanye&ParentKey=schoolMajor'
			});
		},
		// 职位选择
		chooseZhiwei() {
			uni.navigateTo({
				url: '/pages/my/companyChoose/commonChoose?Type=5&headerTitle=职位选择&InfoName=Zhiwei&ParentKey=zhiwei'
			});
		},
		chooseSchool() {
			uni.navigateTo({
				url: '/pages/my/schoolChoose/schoolChoose'
			});
		},
		chooseGongsi() {
			uni.navigateTo({
				url: '/pages/my/companyChoose/companyChoose'
			});
		},
		//  公司列表
		async getCompanyInfo() {
			var self = this;
			var res = await self.Microi.ApiEngine.Run('get_HDfb_info', {
				Type: 0
			});
			this.companyArray = res.Data;
		},

		// 岗位列表
		async getGangweiInfo() {
			var self = this;
			var res = await self.Microi.ApiEngine.Run('get_HDfb_info', {
				Type: 2
			});
			self.GangweiArray = res.Data;
			// self.FormData.Gangwei = res.Data[0].GangweiM;
		},
		// 职位
		async getZhiweiInfo() {
			var self = this;
			var res = await self.Microi.ApiEngine.Run('get_HDfb_info', {
				Type: 5
			});
			self.zhiweiArray = res.Data;
		},
		// 薪资
		async getXinziInfo() {
			var self = this;
			var res = await self.Microi.ApiEngine.Run('get_HDfb_info', {
				Type: 6
			});
			self.XinziArray = res.Data;
		},
		// 学校
		async getSchoolInfo() {
			var self = this;
			var res = await self.Microi.ApiEngine.Run('get_HDfb_info', {
				Type: 7
			});
			self.schoolArray = res.Data;
		},
		// 学历
		async getxueliInfo() {
			var self = this;
			var res = await self.Microi.ApiEngine.Run('get_HDfb_info', {
				Type: 8
			});
			self.xueliArray = res.Data;
		},
		// 专业列表
		async getMajorInfo() {
			var self = this;
			var res = await self.Microi.ApiEngine.Run('get_HDfb_info', {
				Type: 9
			});
			self.MajorArray = res.Data;
			// self.FormData.Zhuanye = res.Data[0].GangweiM;
		},
		bindPickerChange(e, name) {
			this.FormData[name] = e.detail.value;
		},

		companyChange(e) {
			this.FormData.GongsiID = e.Id;
		},
		schoolChange(e) {
			this.FormData.XuexiaoID = e.Id;
		},
		async submit() {
			var self = this;
			if (self.IsDisabled) {
				self.Microi.Tips('请勿重复点击', false);
				return;
			}
			self.IsDisabled = true;
			var FormData = self.FormData;
			if (self.currentTab == 0) {
				if (!self.FormData.Avatar) {
					self.Microi.Tips('请上传头像', false);
					self.IsDisabled = false;
					return;
				}
				if (!self.FormData.Name) {
					self.Microi.Tips('请填写姓名', false);
					self.IsDisabled = false;
					return;
				}
				if (!self.FormData.Avatar) {
					self.Microi.Tips('请上传头像', false);
					self.IsDisabled = false;
					return;
				}
				if (!self.FormData.Sex) {
					self.Microi.Tips('请选择性别', false);
					self.IsDisabled = false;
					return;
				}
				if (!self.FormData.ChushengNY) {
					self.Microi.Tips('请选择出生年月', false);
					self.IsDisabled = false;
					return;
				}
				self.IsDisabled = false;
				self.currentTab++;
				self.btnName = '完成注册';
			} else {
				if (self.FormData.sfIndex == 0) {
					if (!self.FormData.Gongsi) {
						self.Microi.Tips('请选择就职公司', false);
						self.IsDisabled = false;
						return;
					}
					if (!self.FormData.Gangwei) {
						self.Microi.Tips('请选择行业', false);
						self.IsDisabled = false;
						return;
					}

					if (!self.FormData.Zhiwei) {
						self.Microi.Tips('请选择职位', false);
						self.IsDisabled = false;
						return;
					}
					if (!self.FormData.Xinzi) {
						self.Microi.Tips('请选择薪资范围', false);
						self.IsDisabled = false;
						return;
					}
				} else if (self.FormData.sfIndex == 1) {
					if (!self.FormData.BiyeYX) {
						self.Microi.Tips('请选择学校', false);
						self.IsDisabled = false;
						return;
					}
					if (!self.FormData.ZuigaoXL) {
						self.Microi.Tips('请选择学历', false);
						self.IsDisabled = false;
						return;
					}
					if (!self.FormData.Zhuanye) {
						self.Microi.Tips('请选择专业', false);
						self.IsDisabled = false;
						return;
					}

					if (!self.FormData.RuxuestartIndex || !self.FormData.RUxueendIndex) {
						self.Microi.Tips('请选择入学时间', false);
						self.IsDisabled = false;
						return;
					}
					FormData.RuxueSJ = self.startYearArray[FormData.RuxuestartIndex] + '-' + self.endYearArray[FormData.RUxueendIndex];
				} else {
					if (!self.FormData.Gangwei) {
						self.Microi.Tips('请选择行业', false);
						self.IsDisabled = false;
						return;
					}

					if (!self.FormData.Xinzi) {
						self.Microi.Tips('请选择薪资范围', false);
						self.IsDisabled = false;
						return;
					}
				}
				if (!self.FormData.Diqu) {
					self.Microi.Tips('请选择所在地区', false);
					self.IsDisabled = false;
					return;
				}
				FormData.Zhuanye = JSON.stringify(FormData.Zhuanye);
				FormData.Gangwei = JSON.stringify(FormData.Gangwei);
				FormData.Diqu = FormData.Diqu.join(' ');
				FormData.RenzhengZT = '已认证';
				console.log(FormData, 'FormData');
				var res = await self.Microi.FormEngine.UptFormData({
					FormEngineKey: 'sys_user',
					Id: self.CurrentUser.Id,
					_RowModel: FormData
				});
				if (res.Code == 1) {
					this.Microi.Tips('注册成功', true);
					setTimeout(function () {
						uni.reLaunch({
							url: '/pages/tabbar/find/find'
						});
					}, 1000);
				}
			}
		},
		async appChooseAvatar() {
			var self = this;
			uni.chooseImage({
				count: 1,
				crop: { width: 100, height: 100 },
				async success(res) {
					var avatar = await self.uploadImage(res.tempFiles[0].path);
					console.log(avatar, 'avatar');
					self.FormData.Avatar = avatar.url;
				}
			});
		},
		async onChooseAvatar(e) {
			uni.showLoading({
				title: '上传中...'
			});
			var self = this;
			const { avatarUrl } = e.detail;
			var avatar = await self.uploadImage(e.detail.avatarUrl);
			self.FormData.Avatar = avatar.url;

			uni.hideLoading();
		},
		async uploadImage(Path) {
			if (Path.indexOf('https://minio.nbweixin.cn/public') == -1) {
				var res = await this.Microi.Upload({
					Path: '/img', // 文件路径前缀
					Limit: false, // 是否上传到私有存储桶
					Preview: true, // 是否压缩图片
					_FilePath: Path
				});
				console.log(res, 'res');
				if (res.Code == 1) {
					var obj = {
						Path: res.Data.Path,
						Name: res.Data.Name,
						Size: res.Data.Size,
						CreateTime: res.Data.CreateTime,
						Id: res.Data.Id,
						url: this.GetServerPath(res.Data.Path),
						name: res.Data.Name,
						extname: res.Data.Path.split('.')[1]
					};
					console.log('obj', obj);
					return obj;
				}
			} else {
				let endIndex = Path.indexOf('https://minio.nbweixin.cn/public');
				// code = url.substring(0,endIndex)
				var Path1 = Path.substring(0, endIndex);
				console.log(Path, 'Path');
				return Path1;
			}
		},
		GetServerPath(Path) {
			if (!Path) {
				return '';
			}
			return this.Microi.FileServer + Path;
		},
		changeAvatar() {
			uni.chooseImage({
				count: 1,
				sizeType: ['original', 'compressed'],
				sourceType: ['album', 'camera'],
				success: (res) => {
					const tempFilePaths = res.tempFilePaths[0];
					this.Microi.RouterPush('/pages/my/cropper/cropper?src=' + tempFilePaths, true);
				}
			});
			// this.Save()
		},
		bindDateChange(e) {
			this.FormData.ChushengNY = e.detail.value;
		},
		changeSex(index) {
			this.FormData.SexIndex = index;
			this.FormData.Sex = this.sexArray[index];
		}
	}
};
</script>

<style>
.container {
	padding-top: 180rpx;
	padding-left: 25rpx;
	padding-bottom: 100rpx;
	box-sizing: border-box;
}
.header-box {
	font-weight: 800;
	font-size: 40rpx;
	color: #212121;
	font-style: normal;
	text-transform: none;
}
.avatar-add {
	padding: 0;
	margin: 0;
	background: none;
	width: 150rpx;
	height: 150rpx;
	position: relative;
	margin: 75rpx 0 40rpx 0;
}
.camear-img {
	position: absolute;
	bottom: 0;
	right: 10rpx;
	width: 40rpx;
	height: 40rpx;
}
.avatar {
	width: 150rpx;
	height: 150rpx;
	border-radius: 50%;
}
.header-title {
	height: 37rpx;
	font-weight: 500;
	font-size: 27rpx;
	color: #999999;
	line-height: 31rpx;
	font-style: normal;
	text-transform: none;
	margin-top: 6.7rpx;
}
.input-cell {
	display: flex;
	align-items: left;
	justify-content: flex-start;
	flex-direction: column;
	gap: 16rpx;
	margin-bottom: 40rpx;
	margin-right: 25rpx;
}
.input-info {
	/* width: 248rpx; */
	height: 40rpx;
	font-family: PingFang SC, PingFang SC;
	font-size: 28rpx;
	color: #333;
	text-align: left;
	font-style: normal;
	text-transform: none;
	display: flex;
	white-space: nowrap;
}
.input-title {
	height: 47rpx;
	font-family: PingFang SC, PingFang SC;
	font-weight: 500;
	font-size: 33rpx;
	color: #333333;
	line-height: 39rpx;
	text-align: left;
	font-style: normal;
	text-transform: none;
}
.input-box {
	width: 100%;
	height: 74rpx;
	background: #f3f5f9;
	border-radius: 13rpx 13rpx 13rpx 13rpx;
	border: 1rpx solid #f3f5f9;
	box-sizing: border-box;
	padding: 18rpx 30rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 30rpx;
}
.sex-box {
	display: flex;
	align-content: center;
	justify-content: center;
	box-sizing: border-box;
	width: 117rpx;
	height: 54rpx;
	background: #f3f5f9;
	border-radius: 13rpx 13rpx 13rpx 13rpx;
	border: 1rpx solid #f3f5f9;
	gap: 26rpx;
	text-align: center;
	color: #999999;
}
.sex-img {
	width: 27rpx;
	height: 27rpx;
	margin: auto 0;
	fill: red;
}
.picker-view {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 254rpx;
	height: 74rpx;
	background: #f3f5f9;
	border-radius: 13rpx 13rpx 13rpx 13rpx;

	font-weight: 500;
	font-size: 27rpx;
	color: #999999;
	font-style: normal;
	text-transform: none;
	box-sizing: border-box;
	gap: 20rpx;
}
.btn-box {
	width: 345rpx;
	height: 77rpx;
	line-height: 77rpx;
	text-align: center;
	background: #FB353B;
	border-radius: 100rpx 100rpx 100rpx 100rpx;

	font-family: PingFang SC, PingFang SC;
	font-weight: 800;
	font-size: 27rpx;
	color: #ffffff;

	font-style: normal;
	text-transform: none;
	margin: auto;
	margin-top: 133rpx;
}
.sf-box {
	width: 208rpx;
	height: 106rpx;
}
.down-img {
	width: 24rpx;
	height: 36rpx;
	margin: auto 0;
	/* margin-right: 28rpx; */
}
.uni-input {
	font-family: PingFang SC, PingFang SC;
	font-size: 32rpx;
	color: #000;
	line-height: 38rpx;
	font-style: normal;
	text-transform: none;
	white-space: nowrap;
}
zxz-uni-data-select input picker m-cascader {
	font-family: PingFang SC, PingFang SC;
	font-weight: 500;
	font-size: 32rpx;
	color: #999999;
	line-height: 38rpx;
	text-align: left;
	font-style: normal;
	text-transform: none;
}
</style>
